
var config = $.extend(true, {}, listApp, {
    data : {
        service : virtualService,
        fx :"",
        virtualId:"",
        deviceId:"",
        channelCode:""
    },
    methods : {
        init:function () {
            this.virtualId=getQueryString("virtualId");
            this.deviceId=getQueryString("deviceId");
            this.channelCode=getQueryString("channelCode");

            //显示公式
            var _this=this;
            this.service.findById("/"+this.virtualId,null,{
                success:function (res) {
                    _this.fx=res.fx;
                },
                fail:function (ret) {
                    _this.showFailMsg(ret.msg);
                }
            })
        },
        back:function () {
            window.location.href="/web/virtual/index";
        },
        save:function () {
            console.log('fx',this.fx);
            if(this.fx==undefined){
                this.back();
            }else{
                var param={
                    id:this.virtualId,
                    deviceId:this.deviceId,
                    channelCode:this.channelCode,
                    fx:this.fx
                }
                var _this=this;
                this.service.saveFx("/saveFx",param,{
                    success:function (res) {
                        _this.back();
                    },
                    fail:function (ret) {
                        _this.showFailMsg(ret.msg);
                    }
                })
            }

        }
    }
});
var app = new Vue(config);
